<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>BabyOS: b_protocol.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="2.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">BabyOS
   &#160;<span id="projectnumber">V0.0.2</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_b9223522bb56aee4ab59f7ba381d2163.html">bos</a></li><li class="navelem"><a class="el" href="dir_f2a2cc749b6bfcea90db6730434b0bd6.html">core</a></li><li class="navelem"><a class="el" href="dir_37b66dfbfdffce01c33ebea49c49c2c3.html">inc</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">b_protocol.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="b__protocol_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="preprocessor">#ifndef __B_PROTOCOL_H__</span></div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="preprocessor">#define __B_PROTOCOL_H__</span></div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160; <span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="comment">/*Includes ----------------------------------------------*/</span></div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="b__config_8h.html">b_config.h</a>&quot;</span></div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="preprocessor">#if _PROTO_ENABLE</span></div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;<span class="preprocessor">#pragma pack(1) </span></div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;</div><div class="line"><a name="l00060"></a><span class="lineno"><a class="line" href="structb_protocol_head__t.html">   60</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct</span></div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;{</div><div class="line"><a name="l00062"></a><span class="lineno"><a class="line" href="structb_protocol_head__t.html#a9794c0e61506b826b49b458708ae2489">   62</a></span>&#160;    uint8_t <a class="code" href="structb_protocol_head__t.html#a9794c0e61506b826b49b458708ae2489">head</a>;</div><div class="line"><a name="l00063"></a><span class="lineno"><a class="line" href="structb_protocol_head__t.html#a658c495cd1900eadce3b800e3ebdac7a">   63</a></span>&#160;    uint32_t <a class="code" href="structb_protocol_head__t.html#a658c495cd1900eadce3b800e3ebdac7a">device_id</a>;</div><div class="line"><a name="l00064"></a><span class="lineno"><a class="line" href="structb_protocol_head__t.html#a5723e60ffd628510c699eddbce90be23">   64</a></span>&#160;    uint8_t <a class="code" href="structb_protocol_head__t.html#a5723e60ffd628510c699eddbce90be23">len</a>;</div><div class="line"><a name="l00065"></a><span class="lineno"><a class="line" href="structb_protocol_head__t.html#a4d43e8212bdc9dbee866506f04effcea">   65</a></span>&#160;    uint8_t <a class="code" href="structb_protocol_head__t.html#a4d43e8212bdc9dbee866506f04effcea">cmd</a>;</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;}<a class="code" href="structb_protocol_head__t.html">bProtocolHead_t</a>;   </div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;<span class="preprocessor">#pragma pack()</span></div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;</div><div class="line"><a name="l00070"></a><span class="lineno"><a class="line" href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#ga385520b45d23dc3a4dde23de92b85c75">   70</a></span>&#160;<span class="keyword">typedef</span> int (*<a class="code" href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#ga385520b45d23dc3a4dde23de92b85c75">pdispatch</a>)(uint8_t *pbuf, uint32_t len);</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;</div><div class="line"><a name="l00072"></a><span class="lineno"><a class="line" href="structb_protocol_info__t.html">   72</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct</span></div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;{</div><div class="line"><a name="l00074"></a><span class="lineno"><a class="line" href="structb_protocol_info__t.html#abaabdc509cdaba7df9f56c6c76f3ae19">   74</a></span>&#160;    uint32_t <a class="code" href="structb_protocol_info__t.html#abaabdc509cdaba7df9f56c6c76f3ae19">id</a>;</div><div class="line"><a name="l00075"></a><span class="lineno"><a class="line" href="structb_protocol_info__t.html#a65a520465829a72b4b90e063340fccbb">   75</a></span>&#160;    uint8_t <a class="code" href="structb_protocol_info__t.html#a65a520465829a72b4b90e063340fccbb">tx_no</a>;</div><div class="line"><a name="l00076"></a><span class="lineno"><a class="line" href="structb_protocol_info__t.html#a2cd7dc696687cda89345c716c8004772">   76</a></span>&#160;    <a class="code" href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#ga385520b45d23dc3a4dde23de92b85c75">pdispatch</a> <a class="code" href="structb_protocol_info__t.html#a2cd7dc696687cda89345c716c8004772">f</a>;</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;}<a class="code" href="structb_protocol_info__t.html">bProtocolInfo_t</a>;</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;</div><div class="line"><a name="l00090"></a><span class="lineno"><a class="line" href="group___p_r_o_t_o_c_o_l___exported___defines.html#ga683ebecc04749cb0016ec5ad14a2d4f2">   90</a></span>&#160;<span class="preprocessor">#define PROTOCOL_HEAD       0xFE</span></div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;</div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;<span class="keywordtype">int</span> <a class="code" href="group___p_r_o_t_o_c_o_l___exported___functions.html#ga042c82b5764c60b4078866635c8e8c7b">bProtocolRegist</a>(uint32_t <span class="keywordtype">id</span>, uint8_t tx_no, <a class="code" href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#ga385520b45d23dc3a4dde23de92b85c75">pdispatch</a> f);</div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;<span class="keywordtype">int</span> <a class="code" href="group___p_r_o_t_o_c_o_l___exported___functions.html#gadcb3551dcf55a58973810c4f348ffb0d">bProtocolSetID</a>(<span class="keywordtype">int</span> no, uint32_t <span class="keywordtype">id</span>);</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;<span class="keywordtype">int</span> <a class="code" href="group___p_r_o_t_o_c_o_l___exported___functions.html#ga201cb6ee4bc47d6551d221c631490300">bProtocolParseCmd</a>(<span class="keywordtype">int</span> no, uint8_t *pbuf, uint8_t len);</div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;<span class="keywordtype">int</span> <a class="code" href="group___p_r_o_t_o_c_o_l___exported___functions.html#ga52abd16bc752d1f1eb42ac3b0677d60a">bProtocolPack</a>(<span class="keywordtype">int</span> no, uint8_t cmd, uint8_t *psrc, uint8_t *pdes, uint8_t size);</div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;<span class="keywordtype">int</span> <a class="code" href="group___p_r_o_t_o_c_o_l___exported___functions.html#gaa2f6a6a163f48963d802b9f6964f348c">bProtocolUnpack</a>(uint8_t *pbuf, uint8_t len, uint8_t **pdata, uint8_t size);</div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;</div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;<span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;    }</div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;</div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;<span class="preprocessor">#endif  </span></div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;</div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;<span class="comment">/************************ Copyright (c) 2019 Bean *****END OF FILE****/</span></div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;</div><div class="ttc" id="group___p_r_o_t_o_c_o_l___exported___functions_html_gaa2f6a6a163f48963d802b9f6964f348c"><div class="ttname"><a href="group___p_r_o_t_o_c_o_l___exported___functions.html#gaa2f6a6a163f48963d802b9f6964f348c">bProtocolUnpack</a></div><div class="ttdeci">int bProtocolUnpack(uint8_t *pbuf, uint8_t len, uint8_t **pdata, uint8_t size)</div></div>
<div class="ttc" id="structb_protocol_head__t_html_a658c495cd1900eadce3b800e3ebdac7a"><div class="ttname"><a href="structb_protocol_head__t.html#a658c495cd1900eadce3b800e3ebdac7a">bProtocolHead_t::device_id</a></div><div class="ttdeci">uint32_t device_id</div><div class="ttdef"><b>Definition:</b> <a href="b__protocol_8h_source.html#l00063">b_protocol.h:63</a></div></div>
<div class="ttc" id="structb_protocol_head__t_html_a5723e60ffd628510c699eddbce90be23"><div class="ttname"><a href="structb_protocol_head__t.html#a5723e60ffd628510c699eddbce90be23">bProtocolHead_t::len</a></div><div class="ttdeci">uint8_t len</div><div class="ttdef"><b>Definition:</b> <a href="b__protocol_8h_source.html#l00064">b_protocol.h:64</a></div></div>
<div class="ttc" id="structb_protocol_info__t_html_abaabdc509cdaba7df9f56c6c76f3ae19"><div class="ttname"><a href="structb_protocol_info__t.html#abaabdc509cdaba7df9f56c6c76f3ae19">bProtocolInfo_t::id</a></div><div class="ttdeci">uint32_t id</div><div class="ttdef"><b>Definition:</b> <a href="b__protocol_8h_source.html#l00074">b_protocol.h:74</a></div></div>
<div class="ttc" id="group___p_r_o_t_o_c_o_l___exported___types_definitions_html_ga385520b45d23dc3a4dde23de92b85c75"><div class="ttname"><a href="group___p_r_o_t_o_c_o_l___exported___types_definitions.html#ga385520b45d23dc3a4dde23de92b85c75">pdispatch</a></div><div class="ttdeci">int(* pdispatch)(uint8_t *pbuf, uint32_t len)</div><div class="ttdef"><b>Definition:</b> <a href="b__protocol_8h_source.html#l00070">b_protocol.h:70</a></div></div>
<div class="ttc" id="group___p_r_o_t_o_c_o_l___exported___functions_html_ga042c82b5764c60b4078866635c8e8c7b"><div class="ttname"><a href="group___p_r_o_t_o_c_o_l___exported___functions.html#ga042c82b5764c60b4078866635c8e8c7b">bProtocolRegist</a></div><div class="ttdeci">int bProtocolRegist(uint32_t id, uint8_t tx_no, pdispatch f)</div></div>
<div class="ttc" id="structb_protocol_head__t_html"><div class="ttname"><a href="structb_protocol_head__t.html">bProtocolHead_t</a></div><div class="ttdef"><b>Definition:</b> <a href="b__protocol_8h_source.html#l00060">b_protocol.h:60</a></div></div>
<div class="ttc" id="structb_protocol_head__t_html_a4d43e8212bdc9dbee866506f04effcea"><div class="ttname"><a href="structb_protocol_head__t.html#a4d43e8212bdc9dbee866506f04effcea">bProtocolHead_t::cmd</a></div><div class="ttdeci">uint8_t cmd</div><div class="ttdef"><b>Definition:</b> <a href="b__protocol_8h_source.html#l00065">b_protocol.h:65</a></div></div>
<div class="ttc" id="structb_protocol_info__t_html"><div class="ttname"><a href="structb_protocol_info__t.html">bProtocolInfo_t</a></div><div class="ttdef"><b>Definition:</b> <a href="b__protocol_8h_source.html#l00072">b_protocol.h:72</a></div></div>
<div class="ttc" id="group___p_r_o_t_o_c_o_l___exported___functions_html_gadcb3551dcf55a58973810c4f348ffb0d"><div class="ttname"><a href="group___p_r_o_t_o_c_o_l___exported___functions.html#gadcb3551dcf55a58973810c4f348ffb0d">bProtocolSetID</a></div><div class="ttdeci">int bProtocolSetID(int no, uint32_t id)</div></div>
<div class="ttc" id="b__config_8h_html"><div class="ttname"><a href="b__config_8h.html">b_config.h</a></div></div>
<div class="ttc" id="structb_protocol_info__t_html_a65a520465829a72b4b90e063340fccbb"><div class="ttname"><a href="structb_protocol_info__t.html#a65a520465829a72b4b90e063340fccbb">bProtocolInfo_t::tx_no</a></div><div class="ttdeci">uint8_t tx_no</div><div class="ttdef"><b>Definition:</b> <a href="b__protocol_8h_source.html#l00075">b_protocol.h:75</a></div></div>
<div class="ttc" id="structb_protocol_head__t_html_a9794c0e61506b826b49b458708ae2489"><div class="ttname"><a href="structb_protocol_head__t.html#a9794c0e61506b826b49b458708ae2489">bProtocolHead_t::head</a></div><div class="ttdeci">uint8_t head</div><div class="ttdef"><b>Definition:</b> <a href="b__protocol_8h_source.html#l00062">b_protocol.h:62</a></div></div>
<div class="ttc" id="structb_protocol_info__t_html_a2cd7dc696687cda89345c716c8004772"><div class="ttname"><a href="structb_protocol_info__t.html#a2cd7dc696687cda89345c716c8004772">bProtocolInfo_t::f</a></div><div class="ttdeci">pdispatch f</div><div class="ttdef"><b>Definition:</b> <a href="b__protocol_8h_source.html#l00076">b_protocol.h:76</a></div></div>
<div class="ttc" id="group___p_r_o_t_o_c_o_l___exported___functions_html_ga52abd16bc752d1f1eb42ac3b0677d60a"><div class="ttname"><a href="group___p_r_o_t_o_c_o_l___exported___functions.html#ga52abd16bc752d1f1eb42ac3b0677d60a">bProtocolPack</a></div><div class="ttdeci">int bProtocolPack(int no, uint8_t cmd, uint8_t *psrc, uint8_t *pdes, uint8_t size)</div></div>
<div class="ttc" id="group___p_r_o_t_o_c_o_l___exported___functions_html_ga201cb6ee4bc47d6551d221c631490300"><div class="ttname"><a href="group___p_r_o_t_o_c_o_l___exported___functions.html#ga201cb6ee4bc47d6551d221c631490300">bProtocolParseCmd</a></div><div class="ttdeci">int bProtocolParseCmd(int no, uint8_t *pbuf, uint8_t len)</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>
